package lgq.service;

import java.util.List;

import util.Page;

import model.Course;

import dao.CourseDAO;
import dao.impl.CourseDAOImpl;

public class CourseManager {
	CourseDAO cd=new CourseDAOImpl();
	public Page<Course>getAllCourse(int pageNo, int pageSize) {
		return cd.getAllCourse(pageNo, pageSize);
	}
	public Course getById(int id)
	{
		return cd.getById(id);
	}
	public boolean updateCourse(int id,String name,double coursetime)
	{
		Course c=new Course();
		c.setId(id);
		c.setName(name);
		c.setCoursetime(coursetime);
		return cd.updateCourse(c);
	}
	public boolean ifExists(String name)
	{
		return cd.ifExists(name);
	}
	public boolean addCourse(String name,double coursetime)
	{
		Course c=new Course();
		c.setName(name);
		c.setCoursetime(coursetime);
		return cd.addCourse(c);
	}
	public boolean deleteByCourseId(int id)
	{
		return cd.deleteByCourseId(id);
	}
	public List<Course> getAll()
	{
		return cd.getAll();
	}
	public Page<Course> getByName(int pageNo, int pageSize,String name)
	{
		return cd.getCourseByName(pageNo, pageSize, name);
	}
	public Page<Course> getByTime(int pageNo, int pageSize,double time)
	{
		return cd.getByTime(pageNo, pageSize, time);
	}
}
